cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
include($ENV{ROS_ROOT}/core/rosbuild/FindPkgConfig.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
rosbuild_genmsg()
#uncomment if you have defined services
rosbuild_gensrv()

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})

rosbuild_add_boost_directories()

rosbuild_add_library(serialPort src/serialPort.cpp)
rosbuild_add_library(epuckInterface src/epuckInterface.cpp)

rosbuild_add_library(epuckPosition2d src/epuckPosition2d.cpp)
rosbuild_add_library(epuckIR src/epuckIR.cpp)
rosbuild_add_library(epuckLEDs src/epuckLEDs.cpp)
rosbuild_add_library(epuckCamera src/epuckCamera.cpp)

target_link_libraries( epuckPosition2d epuckInterface)
target_link_libraries( epuckIR epuckInterface)
target_link_libraries( epuckLEDs epuckInterface)
target_link_libraries( epuckCamera epuckInterface)

rosbuild_add_library( epuckLibrary src/epuckDriver.cpp)
target_link_libraries( epuckLibrary serialPort)
target_link_libraries( epuckLibrary epuckPosition2d)
target_link_libraries( epuckLibrary epuckIR)
target_link_libraries( epuckLibrary epuckLEDs)
target_link_libraries( epuckLibrary epuckCamera) 
rosbuild_link_boost( epuckLibrary thread)

rosbuild_add_library(reader src/configFile.cpp)
pkg_check_modules(TINYXML REQUIRED tinyxml)
include_directories(${TINYXML_INCLUDE_DIRS} )
link_directories(${TINYXML_LIBRARY_DIRS})
target_link_libraries(reader ${TINYXML_LIBRARIES})

rosbuild_add_executable(epuck src/epuck.cpp )
target_link_libraries( epuck  epuckLibrary)
target_link_libraries( epuck  reader)

rosbuild_add_executable(epuckReqResTest src/epuckReqResTest.cpp )
target_link_libraries( epuckReqResTest  epuckLibrary)

rosbuild_add_executable(epuckSubTest src/epuckSubTest.cpp )
target_link_libraries( epuckSubTest  epuckLibrary)

rosbuild_add_executable(epuckLEDTest src/epuckLEDTest.cpp )
target_link_libraries( epuckLEDTest  epuckLibrary)

rosbuild_add_executable(epuckPubTest src/epuckPubTest.cpp )
target_link_libraries( epuckPubTest  epuckLibrary)

rosbuild_add_executable(testMoveAll src/testMoveAll.cpp )
target_link_libraries( testMoveAll  epuckLibrary)

rosbuild_add_executable(testServiceOdomAll src/testServiceOdomAll.cpp )
target_link_libraries( testServiceOdomAll  epuckLibrary)

rosbuild_add_executable(testOdomAll src/testOdomAll.cpp )
target_link_libraries( testOdomAll  epuckLibrary)
